<?php
function encrypt($string, $key) {
	$result = '';
	for($i=0; $i<strlen($string); $i++) {
		$char = substr($string, $i, 1);
		$keychar = substr($key, ($i % strlen($key))-1, 1);
		$char = chr(ord($char)+ord($keychar));
		$result.=$char;
	}

	return base64_encode($result);
}

function decrypt($string, $key) {
	$result = '';
	$string = base64_decode($string);
	
	for($i=0; $i<strlen($string); $i++) {
		$char = substr($string, $i, 1);
		$keychar = substr($key, ($i % strlen($key))-1, 1);
		$char = chr(ord($char)-ord($keychar));
		$result.=$char;
	}

	return $result;
}

$password = encrypt('rexwang','listing');
//echo $password;
//echo decrypt($password,'listing');




?> 
<?php

$to = 'rex_wangyi@hotmail.com,rexwangyi@gmail.com';

$ToName = 'ファンの皆様';

$ToMail = 'rex_wangyi@hotmail.com';

$FromName = '菅山かおる';

$FromMail = 'rexwangyi@gmail.com';

$subject = '応援してね';

$message = "メール本文\rメール本\n文メール\r\n本文メール<br>本文メール本文";



// 念の為、言語と文字コードの設定

mb_language("Japanese");

mb_internal_encoding("UTF-8");

mb_detect_order("ASCII, JIS, UTF-8, EUC-JP, SJIS");



// To を変換

//$ToName = mb_encode_mimeheader(mb_convert_encoding($ToName,'JIS','auto'));

//$header .= 'To: '.$ToName.' <'.$ToMail.'>'."￥n";



// From を変換

$FromName = mb_encode_mimeheader(mb_convert_encoding($FromName,'JIS','auto'));

$header .= 'From: '.$FromName.' <'.$FromMail.'>'."￥n";



// メール を送信

//$r = mb_send_mail($to, $subject, $message, $header);



//if($r) {

//echo "メール送信成功";

//}else{

//echo "メール送信失敗";

//}

//echo "Week:"+date("Ymd",strtotime("Monday",strtotime($_GET["objectDate"])));
//echo "Week:"+date("Ymd",strtotime("Monday",strtotime($_GET["objectDate"])));

            if(date("w",strtotime($_GET["objectDate"])) == 1)
            {
                echo "Week:".date("Ymd",strtotime("Monday",strtotime($_GET["objectDate"])));
            }
            else
            {
                echo "Week:".date("Ymd",strtotime("last Monday",strtotime($_GET["objectDate"])));
            }
?>


